package com.lh.pospi.x_store.utils;

import android.content.Context;

import com.qmuiteam.qmui.widget.QMUIProgressBar;
import com.qmuiteam.qmui.widget.dialog.QMUITipDialog;

public class LoadingUtil {
    private Context context;
    private QMUITipDialog mTipDialog;

    public LoadingUtil(Context context) {
        this.context = context;
    }
    public void show(String msg){
        if (mTipDialog == null) {
            mTipDialog = new QMUITipDialog.Builder(context)
                    .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
                    .setTipWord(msg)
                    .create();
            mTipDialog.setCancelable(false);
            mTipDialog.show();
        }
    }
    public void show(){
        if (mTipDialog == null) {
            mTipDialog = new QMUITipDialog.Builder(context)
                    .setIconType(QMUITipDialog.Builder.ICON_TYPE_LOADING)
                    .setTipWord("正在加载")
                    .create();
            mTipDialog.setCancelable(false);
            mTipDialog.show();
        }
    }

    public void showProgress() {
        QMUIProgressBar progressBar = new QMUIProgressBar(context);
    }
    public void close(){
        if (mTipDialog != null) {
            mTipDialog.dismiss();
            mTipDialog = null;
        }
    }
}
